﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service.BusinessLayer.Entities;
using Service.DataAccess.DataAccessHelper;
using System.Data.SqlClient;
using System.Data;
namespace Service.DataAccess.DataAccessLogic
{
    public class MatHang_DA
    {
        public void them(MatHang mh)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[2];
            par[0] = new SqlParameter("@mamh", mh.Mamh);
            par[1] = new SqlParameter("@tenmh", mh.Tenmh);
            help.InsertQuery("sp_mathang_them", par);
        }
        public void sua(MatHang mh)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[2];
            par[0] = new SqlParameter("@mamh", mh.Mamh);
            par[1] = new SqlParameter("@tenmh", mh.Tenmh);
            help.UpdateQuery("sp_mathang_sua", par);
        }
        public void xoa(string mamh)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@mamh", mamh);
            help.DeleteQuery("sp_mathang_xoa", par);
        }
        public DataSet layds()
        {
            Helper help = new Helper();
            DataSet ds = help.SelectQuery("sp_mathang_layds");
            return ds;
        }
    }
}
